﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WebResourcesManager.Forms
{
    public partial class NewFolderDialog : Form
    {
        private string folderName;

        public NewFolderDialog()
        {
            InitializeComponent();
        }

        public string FolderName { get { return this.folderName; } }

        private void btnValidate_Click(object sender, EventArgs e)
        {
            if (this.txtFolderName.Text.Length > 0)
            {
                this.folderName = this.txtFolderName.Text;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show(this, "Please provide a folder name!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void txtFolderName_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnValidate_Click(null, null);
            }
        }
    }
}
